package com.itfreer.gis.locus.data;


import com.alibaba.dubbo.config.annotation.Reference;
import com.itfreer.form.api.BaseRestService;
import com.itfreer.form.api.BaseService;
import com.itfreer.gis.locus.data.dto.WorkSitutationDTO;
import com.itfreer.gis.locus.data.entity.LocusWorkEntity;
import com.itfreer.gis.locus.data.vo.WorkSitutationVO;
import com.itfreer.utils.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 定义巡护任务Rest服务接口
 */
@RestController
@RequestMapping("/locuswork")
@Api("巡护任务")
public class RestLocusWorkService extends BaseRestService<LocusWorkEntity> {
	
	@Autowired(required = false)
	private LocusWorkService service;

	@Reference(
			lazy = true,
			check = false
	)
	private LocusWorkService dubboService;

	@Override
	protected BaseService<LocusWorkEntity> getService() {
		return this.service == null ? this.dubboService : this.service;
	}

	@RequestMapping("/getSituation")
	public ResponseEntity<WorkSitutationVO> getSituation(@RequestBody WorkSitutationDTO workSitutationDTO) {
		return service.getSituation(workSitutationDTO);
	}

	@ApiOperation("按时间查询巡护统计")
	@RequestMapping("/getDataSituationByState")
	public ResponseEntity<List<WorkSitutationVO>> getDataSituationByState(@RequestBody WorkSitutationDTO workSitutationDTO) {
		return service.getDataSituationByState(workSitutationDTO);
	}


}
